import { RouteRecordRaw } from "vue-router";

import NoAuth from "@/views/user/NoAuth.vue";
import AdminView from "@/views/user/AdminView.vue";
import ACCESS_ENUM from "@/access/accessEnum";
import UserLoginView from "@/views/user/UserLoginView.vue";
import UserRegisterView from "@/views/user/UserRegisterView.vue";
import UserLayout from "@/layouts/UserLayout.vue";
import ExampleView from "@/views/user/ExampleView.vue";
import AboutView from "@/views/user/AboutView.vue";
import AddQuestionView from "@/views/question/AddQuestionView.vue";
import ManageQuestionView from "@/views/question/ManageQuestionView.vue";
import UpdateQuestionView from "@/views/question/UpdateQuestionView.vue";
import QuestionListView from "@/views/question/QuestionListView.vue";
import ViewQuestionView from "@/views/question/ViewQuestionView.vue";

export const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    component: ExampleView,
  },
  {
    path: "/questionList",
    name: "QuestionList",
    component: QuestionListView,
    meta: {
      webAccess: ACCESS_ENUM.WEB_NEED_USER,
    },
  },
  {
    path: "/example",
    name: "ExampleView",
    component: ExampleView,
  },
  {
    path: "/view/question/:id",
    name: "ViewQuestion",
    component: ViewQuestionView,
    props: true,
    meta: {
      hideInMenu: true,
      webAccess: ACCESS_ENUM.WEB_NEED_USER,
    },
  },

  {
    path: "/add/question",
    name: "AddQuestion",
    component: AddQuestionView,
    meta: {
      webAccess: ACCESS_ENUM.WEB_NEED_ADMIN,
    },
  },
  {
    path: "/update/question",
    name: "UpdateQuestion",
    component: AddQuestionView,
    meta: {
      webAccess: ACCESS_ENUM.WEB_NEED_ADMIN,
      hideInMenu: true,
    },
  },

  {
    path: "/manage/question",
    name: "ManageQuestion",
    component: ManageQuestionView,
    meta: {
      webAccess: ACCESS_ENUM.WEB_NEED_ADMIN,
    },
  },

  {
    path: "/user",
    name: "User",
    component: UserLayout,
    meta: {
      hideInMenu: true,
    },
    children: [
      {
        path: "/user/login",
        name: "UserLogin",
        component: UserLoginView,
      },
      {
        path: "/user/register",
        name: "UserRegister",
        component: UserRegisterView,
      },
    ],
  },
];
